<template>
<div>
  <el-button v-permission="'cate-add'"  >新增</el-button>
</div>
<div>
<el-table
  :data="tableData"
  style="width: 100%; margin-bottom: 20px"
  row-key="_id"
  border
  default-expand-all
  center
>
  <el-table-column prop="name" label="名字" width="200"   >
  </el-table-column>
  <el-table-column prop="icon" label="图片"  width="200" >

    <template #default="scope">
      <el-image style="width: 30px; height: 30px" preview-teleported :preview-src-list="[scope.row.icon]" :src="scope.row.icon" />
    </template>

  </el-table-column>
  <el-table-column prop="description" label="描述"  width="300"   />


  <el-table-column label="操作"  >

  <el-button  v-permission="'cate-add'">编辑</el-button>
  <el-button v-permission="'cate-delete'"  type="danger">删除</el-button>

  </el-table-column>
</el-table>
</div>


</template>
<script setup   lang="ts">

import {read} from '@/api/cate'


import {ref,onMounted,}  from 'vue'

const  tableData = ref([])
onMounted(async ()=>{

    const {data:{rows}}  =  await read()

    console.log(rows);



    tableData.value = rows


})


</script>
